{extend name="index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">企服套餐</div>
    <div class="layui-card-body">
        <div class="layui-form">
            <table class="layui-hide" id="currentTable" lay-filter="currentTable"
                   data-auth-add="{:$auth->check('company_package/add')}"
                   data-auth-edit="{:$auth->check('company_package/edit')}"
                   data-auth-delete="{:$auth->check('company_package/del')}"
                   data-auth-recyclebin="{:$auth->check('company_package/recyclebin')}"
            ></table>
        </div>
    </div>
</div>
<script type="text/html" id="barTool">
    <a data-open='{:url("edit")}?id={{ d.id }}'
       class="layui-btn layui-btn-xs {:$auth->check('special/edit')?'':'layui-hide'}" title="编辑"><i
            class='iconfont icon-brush_fill'></i></a>
    <a href='{:url("del")}?id={{ d.id }}'
       class="layui-btn layui-btn-danger layui-btn-xs layui-tr-del {:$auth->check('item/del')?'':'layui-hide'}"><i
            class='iconfont icon-trash_fill'></i></a>


    <a data-open='{:url("/admin/company_price/index")}?cid={{ d.id }}'
       class="layui-btn layui-btn-xs {:$auth->check('special/edit')?'':'layui-hide'}" title="编辑">设置价格</a>


</script>
{/block}
{block name="script"}
<script type="text/javascript">
    layui.use('yznTable', function () {
        var table = layui.yznTable;

        var init = {
            table_elem: '#currentTable',
            table_render_id: 'currentTable',
            add_url: '{:url("add")}',
            edit_url: '{:url("edit")}',
            delete_url: '{:url("del")}',
            modify_url: "{:url('multi')}",
            recyclebin_url: "{:url('recyclebin')}",
        };

        var cate = <?php echo $cate; ?>;


        table.render({
            init: init,
            toolbar: ['refresh', 'add', 'delete', 'recyclebin'],
            url: '{:url("index")}',
            cols: [
                [
                    {type: 'checkbox', fixed: 'left'},
                    { field: 'sort',align: 'center', width: 80, title: '排序', edit: 'text' },

                    {field: 'id', title: 'id', minWidth: 80, align: 'center', search: false},
                    {
                        field: 'cate.name',
                        align: 'center',
                        title: '分类',
                        searchOp: 'LIKE',
                        minWidth: 110,
                        selectList:cate
                    },
                    {field: 'name', align: 'center', title: '标题',  searchOp: 'LIKE', minWidth: 180},
                    {
                        field: 'type_name',
                        align: 'center',
                        title: '基础类名称',
                        searchOp: 'LIKE',
                        minWidth: 110,
                        search: false
                    },
                    {
                        align: 'center',
                        field: 'image',
                        title: '图片',
                        minWidth: 80,
                        search: false,
                        minWidth: 110,
                        templet: yznTable.formatter.image
                    },
                    {
                        field: 'status',
                        align: 'center',
                        width: 120,
                        title: '状态',
                        unresize: true,
                        templet: yznTable.formatter.switch,
                        tips: "显示|隐藏",
                        selectList: {0: '冻结', 1: '正常'},
                    },
                    // {field: 'sort',search:false, title: '排序', minWidth: 80, minWidth: 110},
                    {
                        field: 'create_time',
                        align: 'center',
                        title: '创建时间',
                        search:false,
                        minWidth: 80,
                        width: 180,
                        templet: yznTable.formatter.datetime
                    },
                    {
                        field: 'update_time',
                        align: 'center',
                        search:false,
                        title: '更新时间',
                        minWidth: 80,
                        width: 180,
                        templet: yznTable.formatter.datetime
                    },
                    {fixed: 'right', align: 'center', width: 180, title: '操作', toolbar: '#barTool'}

                ]
            ],
            page: {}
        });

        yznTable.bindevent();
    });
</script>
{/block}